#ifndef Details_H
#define Details_H

#include <QtGui>
#include "Item.h"

namespace Xps
{
	class Details : public QWidget
	{
		QVBoxLayout* layout;
		QWidget* header;
		QPixmap img;
		
	public:
		QVBoxLayout* content_layout;
		QWidget* content;
		
		Details(QString title, QString imgpath) : QWidget()
		{
			content = new QWidget();
			content_layout = new QVBoxLayout();
			content->setLayout(content_layout);

			img = QPixmap(imgpath).scaledToHeight(25,Qt::SmoothTransformation);
			header = setupHeader(title, img);
			
			layout = new QVBoxLayout();
			layout->setSpacing(0);
			layout->setMargin(0);
			setLayout(layout);
			setObjectName("Details");
			setStyleSheet("#Details { background-color: white; }");
			resize(300,200);
			setWindowFlags(Qt::Tool);

			layout->addWidget(header);
			layout->addWidget(content);
		};

		virtual void setItem(Item* item) = 0;

				
		QWidget* setupHeader(QString head_text, QPixmap head_img)
		{
			QFont headfont("Arial", 10, QFont::Bold);
			QLabel* head = new QLabel();
			QLabel* img = new QLabel(head);
			QLabel* text = new QLabel(head_text,head);
			
			text->setFont(headfont);
			text->setStyleSheet("background: none");

			img->setPixmap(QPixmap(head_img));
			img->setFixedWidth(26);
			img->setStyleSheet("background: none");
			
			head->setFixedHeight(30);
			head->setLayout(new QHBoxLayout());
			head->setBaseSize(500,30);
			head->layout()->addWidget(img);
			head->layout()->addWidget(text);
			head->layout()->setMargin(0);
			head->setStyleSheet("background: url(:/rs/images/bg.png);");
			
			return head;
		}

	};
}

#endif